<template>
  <el-table :data="data" stripe border>
    <el-table-column :label="item.label" :prop="item.prop" v-for="item in tablePropData" :key="item.prop" :width="item.width">
      <template slot-scope="scope">
        <div>
          <div v-if="item.prop=='state'">
            {{states[scope.row[item.prop]]}}
          </div>
          <div v-else-if="item.prop=='valueAB'||item.prop=='valueCD'||item.prop=='valueAD'">
            {{valueState[scope.row[item.prop]]}}
          </div>
          <div v-else>
            {{scope.row[item.prop]}}
          </div>
        </div>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: '',
  props: {
    data: {
      type: Array,
      required: true
    },
    mode: {
      type: Number,
      required: true
    },
    type: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      tablePropData: null,
      states: ['正常', '禁用', '完成', '废弃'],
      valueState: ['未测试', '进行测试', '废弃测试结果']
    }
  },
  created() {
    // this.tablePropData = this.$store.state.dev_type_params[this.mode]
    let cache = null
    switch (this.mode) {
      case 1:
        cache = this.qzyJudge(this.type)
        break
      case 2:
        cache = this.szyJudge()
        break
      case 3:
        cache = this.sljJudge()
        break
    }
    this.tablePropData = cache
  },
  methods: {
    // 全站仪判断
    qzyJudge(type) {
      console.log(type);
      switch (type) {
        case 1:
          return this.$store.state.dev_type_params[10]
          break
        case 2:
          return this.$store.state.dev_type_params[11]
          break
        case 3:
          return this.$store.state.dev_type_params[10]
          break
        case 4:
          break
        default:
          return this.$store.state.dev_type_params[10]
      }
    },
    // 水准仪判断
    szyJudge(type) {
      switch (type) {
        case 1:
          break
        case 2:
          break
        case 3:
          break
        case 4:
          break
        default:
          return this.$store.state.dev_type_params[20]
      }
    },
    // 收敛剂判断
    sljJudge(type) {
      switch (type) {
        case 1:
          break
        case 2:
          break
        case 3:
          break
        case 4:
          break
        default:
          return this.$store.state.dev_type_params[30]
      }
    }
  }
}
</script>

<style>
</style>